package com.ruoyi.bussiness.controller;

import com.ruoyi.common.core.api.ApiResult;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.pagination.Paging;
import com.ruoyi.common.domain.business.ShoppingCart;
import com.ruoyi.common.param.ShoppingCartParam;
import com.ruoyi.common.service.business.ShoppingCartService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 购物车Controller
 *
 * @author Song
 * @date 2024-10-29
 */
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/common/cart")
@Api(tags = "购物车")
public class ShoppingCartController extends BaseController {

    private final ShoppingCartService shoppingCartService;

    /**
     * 查询购物车列表
     */
    @GetMapping("/page")
    @ApiOperation(value = "分页查询购物车列表")
    public ApiResult<Paging<ShoppingCart>> page(ShoppingCartParam shoppingCartParam) {
        Paging<ShoppingCart> page = shoppingCartService.pageShoppingCart(shoppingCartParam);;
        return ApiResult.ok(page);
    }


}
